#pragma once
#include <wdm.h>

namespace windows {
namespace kernal {
class Device {
 public:
  Device(PDRIVER_OBJECT driver_object);
  ~Device();
  NTSTATUS Create(_In_ LPCWSTR device_name, _In_ LPCWSTR symbolic_link_name);
  VOID Destroy();

  NTSTATUS AddPendingIrp(PIRP irp);
  NTSTATUS CompleteAllPendingIrp();

 private:
  NTSTATUS CreateDevice(_In_ LPCWSTR device_name);

  NTSTATUS CreateSymbolicLink(_In_ LPCWSTR symbolic_link_name);

  NTSTATUS FormatDeviceName(_In_ LPCWSTR device_name,
                            _Out_ LPWSTR standard_device_name,
                            _Inout_ SIZE_T &size);

  NTSTATUS FormatSymbolicLinkName(_In_ LPCWSTR symbolic_link_name,
                                  _In_ LPWSTR standard_symbolic_link_name,
                                  _Inout_ SIZE_T &size);

 private:
  PDRIVER_OBJECT driver_object_;
  WCHAR device_name_[0x100];
  WCHAR symbolic_link_name_[0x100];
  PDEVICE_OBJECT device_object_;
  struct PendingIrp {
    LIST_ENTRY node;
    PIRP irp;
  } pending_irp_list_;
};
}
};



